/* Google Fonts import */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Common Variables (Modern Indigo Theme) */
    --navy: #4f46e5;
    /* Indigo-600 */
    --navy-deep: #4338ca;
    /* Indigo-700 */
    --accent-green: #06b6d4;
    /* Cyan-500 */
    --section-green: #4f46e5;
    /* Indigo-600 */
    --link-blue: #0891b2;
    /* Cyan-600 */

    --bg: #f8fafc;
    --text: #1e293b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    --input-bg: #ffffff;
    --input-border: #cbd5e1;

    --font: 'Outfit', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";

    /* Calculator Specific Vars (From New Calc) */
    --calc-btn-grad-top: #fcfcfc;
    --calc-btn-grad-bot: #dcdcdc;
}

[data-theme="dark"] {
    --navy: #312e81;
    /* Indigo-900 */
    --navy-deep: #1e1b4b;
    /* Indigo-950 */
    --accent-green: #22d3ee;
    /* Cyan-400 */
    --section-green: #818cf8;
    /* Indigo-400 */
    --link-blue: #38bdf8;
    /* Sky-400 */

    --bg: #0f172a;
    /* Slate-900 */
    --text: #f1f5f9;
    --card-bg: #1e293b;
    /* Slate-800 */
    --border-color: #334155;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    --input-bg: #1e293b;
    --input-border: #475569;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

/* Force override WP theme styles in Dark Mode */
html[data-theme="dark"] body {
    background-color: var(--bg) !important;
    color: var(--text) !important;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.4;
    transition: background 0.3s ease, color 0.3s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Top Bar */
.topbar {
    background: var(--navy);
    color: #fff;
    transition: background 0.3s ease;
}

.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
}

.brand {
    font-weight: 800;
    letter-spacing: .2px;
    font-size: 32px;
    line-height: 1;
    display: inline-flex;
    align-items: baseline;
}

.brand__calc {
    color: #fff;
}

.brand__dotnet {
    color: var(--accent-green);
}

/* Theme Toggle */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-left: 1rem;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Language Select */
.lang-select {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.lang-select:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.lang-select option {
    background: #fff;
    color: #333;
}

[data-theme="dark"] .lang-select option {
    background: var(--card-bg);
    color: var(--text);
}

/* Hero */
.hero {
    padding: 28px 0 18px;
}

.hero__grid {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 28px;
    align-items: start;
}

/* --- NEW CALCULATOR STYLES MATCHING PROVIDED LOGIC --- */
.calc-mockup {
    background: #fdfdfd;
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    /* No max-width restriction to fit container */
    width: 100%;
}

[data-theme="dark"] .calc-mockup {
    background: var(--card-bg);
    border-color: var(--border-color);
}

.calc-display-top {
    text-align: right;
    font-family: monospace;
    font-size: 14px;
    color: var(--text);
    padding: 0 5px 5px;
    opacity: 0.7;
    min-height: 24px;
}

.calc-display-main {
    background-color: var(--navy-deep);
    color: #fff;
    font-family: monospace;
    font-size: 24px;
    text-align: right;
    padding: 8px 10px;
    margin-bottom: 10px;
    border: 1px solid var(--navy);
    border-radius: 4px;
}

.calc-keypad {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-gap: 5px;
}

.calc-keypad button {
    padding: 10px 0;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    border: 1px solid #aaa;
    border-radius: 4px;
    background: linear-gradient(to bottom, var(--calc-btn-grad-top), var(--calc-btn-grad-bot));
    color: #000;
    font-family: sans-serif;
    transition: all 0.1s;
}

[data-theme="dark"] .calc-keypad button {
    background: linear-gradient(to bottom, #475569, #334155);
    border-color: #64748b;
    color: #f8fafc;
}

.calc-keypad button:hover {
    filter: brightness(1.1);
}

.calc-keypad button:active {
    transform: translateY(1px);
}

/* Radio group spans 2 columns */
.radio-group {
    grid-column: span 2;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 11px;
    background: #f0f0f0;
    border-radius: 4px;
}

[data-theme="dark"] .radio-group {
    background: #334155;
}

.radio-group label {
    cursor: pointer;
}

/* Specific button colors */
.btn-blue {
    color: blue !important;
}

[data-theme="dark"] .btn-blue {
    color: #60a5fa !important;
}

.calc-history {
    max-height: 100px;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
    margin-top: 15px;
    padding-top: 10px;
    font-size: 12px;
    color: var(--text);
    opacity: 0.8;
}

.history-item {
    padding: 2px 5px;
    border-bottom: 1px solid var(--border-color);
}


/* Right side (Hero Text) */
.heroText {
    padding-top: 8px;
}

.heroText__title {
    margin: 0 0 14px;
    color: var(--navy-deep);
    font-size: 30px;
    font-weight: 800;
}

[data-theme="dark"] .heroText__title {
    color: var(--text);
}

.search {
    display: flex;
    gap: 10px;
}

.search__input {
    flex: 1;
    height: 44px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .06);
    font-size: 15px;
    color: var(--text);
    transition: all 0.3s ease;
}

.search__btn {
    height: 44px;
    padding: 0 18px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, .18);
    background: var(--navy);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.search__btn:hover {
    filter: brightness(1.1);
}

/* Directory Grid (Refined match to Omni) */
.directory {
    padding: 20px 0 60px;
    background: var(--bg);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    /* Responsive grid approx 6 items wide on large screens */
    gap: 16px;
    align-items: stretch;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    /* Light gray border */
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    min-height: 160px;
    /* Square-ish aspect */
}

.card:hover {
    border-color: var(--navy);
    /* Blue border on hover */
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}

.card__link-wrapper {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px 16px;
    width: 100%;
}

.avatar {
    width: auto;
    height: auto;
    border-radius: 0;
    margin: 0 0 16px;
    border: none;
    box-shadow: none;
    background: none;
    filter: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--navy);
    /* Blue Icon */
}

[data-theme="dark"] .avatar {
    color: #ffffff;
}

/* Specific icons size adjustment if needed */
.avatar ion-icon {
    --ionicon-stroke-width: 32px;
}

.card__title {
    display: block;
    margin: 0 0 8px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    /* Dark text */
}

.card p {
    font-size: 13px;
    color: #64748b;
    /* Slate-500 */
    margin: 0;
}

[data-theme="dark"] .card p {
    color: #94a3b8;
    /* Slate-400 for better contrast */
}

/* Remove old links styles */
.links {
    display: none;
}

/* Responsive */
@media (max-width:980px) {
    .hero__grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
}

@media (max-width:560px) {
    .topbar__inner {
        padding: 14px 18px;
    }

    .brand {
        font-size: 28px;
    }

    .hero__grid {
        grid-template-columns: 1fr;
    }

    .calc-keypad {
        grid-gap: 3px;
    }

    .grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on mobile */
        gap: 12px;
    }
}

/* --- Footer CTA (All Calculators) --- */
.footer-cta {
    text-align: center;
    padding: 30px 0 50px;
    background: var(--bg);
    /* Match directory bg */
    width: 100%;
}

.btn-all-calcs {
    background: #5856d6;
    /* Purple */
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    padding: 12px 32px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-all-calcs:hover {
    background: #4a47a3;
    /* Darker Purple */
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-all-calcs ion-icon {
    font-size: 1.2em;
}

/* --- Site Footer --- */
.site-footer {
    background: #e6e6e6;
    color: #333;
    font-size: 13px;
    line-height: 1.6;
    padding: 40px 0;
    font-family: Arial, sans-serif;
    border-top: 1px solid #d4d4d4;
}

.site-footer p {
    margin-bottom: 16px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.footer-links {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.footer-links a {
    color: #000;
    text-decoration: none;
    margin: 0 5px;
}

.footer-links a:hover {
    color: #5856d6;
    /* Purple Hover */
    text-decoration: underline;
}

/* Dark Mode Overrides for Footer */
[data-theme="dark"] .footer-cta {
    background: var(--bg);
}

[data-theme="dark"] .site-footer {
    background: #1e293b;
    color: #cbd5e1;
    border-top-color: #334155;
}

[data-theme="dark"] .footer-links {
    border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .footer-links a {
    color: #94a3b8;
}